<html><head>
<title>个人中心</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/user-center.css">
<include file="./Public/public/public.html" />
<script type="text/javascript" src="{$app_path}{$static_path}/js/jquery.formatdomain.js"></script>
<script>
        $(document).ready(function(){
			var inputDomain = $("#inputDomain");
            $("[name='audit[category_id]']").change(function(){
                   $regex=$(this).find("option:selected").attr('regex');
                   if($regex){
                        $("#inputDomain").attr("regex",$regex);
                   }else{
                        $("#inputDomain").attr("regex","");
                   }

            });
            $("#inputDomain").formatDomain({
                rows:600,
                rowsError:function(rows){
                    showModal('输入不能超过' + rows + '行');
                    $("#inputDomain").addClass("input-error");
                },
                error:function(el){
                    showModal(el + '不是一个合法的域名');
                    $("#inputDomain").addClass("input-error");
                },
                end:function(status){
                    if(status){$("#inputDomain").removeClass("input-error");  }
                }
            });

            $("[action='confirmsubmit']").on("click",function(){
                $('#errorDomain').hide();
                $('#auditForm').Qvalidate({
                    onError:function(element,msg){
                        $(element).addClass("input-error");
                        showModal({
                            msg:msg
                        });
                    }
                });

                if (inputDomain.attr("type")=="false") {
                    showModal('域名输入有误，请修改后提交');
                    return;
                }
                if ( $('#auditForm').Qvalidate.valid()) {
                	Qsubmit($('#auditForm'), function (msg, resp) {
                        showModal(msg);
                        setTimeout("jumpDomainAudit()", 3000 );
                    },function(msg,resp){
                    	if(resp.status==4){
                    		var errHtmlDom='';
                    		var errorDoArr=(resp.errdomlist).split(',');
                    		$.each(errorDoArr,function(n,value) {
                    			errHtmlDom+="<p style='line-height:5px;'>"+value+"</p><br/>";
    						});
                    		$("#errorDomainList").html(errHtmlDom);
                    		$('[popup="errorSaveDomain"]').find("#popupTitle").html(msg);
                            $('[popup="errorSaveDomain"]').reveal();
                    	}else {
                    		showModal(msg);
                            if(resp.errorDomain){
                                $('#errorDomain').find('.cnt-tips').html(resp.msg+"<br/>"+resp.errorDomain);
                                $('#errorDomain').show();
                            }
                    	}
                        
                        $('#auditForm').resetImgcode();
                    });
                }

            })
        })

       function jumpDomainAudit(){
            window.location = "{:U('DomainAudit/index')}";
        }

        var checkDomainCount = 0;
        var checkDomainReturn = 0;
        var errorDomain = '';

        function chackAndSubmit(){
            checkDomainCount = 0;
            checkDomainReturn = 0;
            errorDomain='';
            $('div.right').showLoading();
            var subLength = 20;
            var domains = $("[name='audit[domains]']").val();
            var domainArr = domains.split('\n');
            checkDomainCount = Math.floor((domainArr.length-1)/subLength)+1;

            for(var i=0;i<checkDomainCount;i++){
                var temp =  domainArr.slice(i*subLength, (i+1)*subLength);
            }
        }

       
    </script>
</head>
<body>
<include file="./Public/public/top.html" />

<div class="layout-wrap">
    <!--已审核-->
    <div class="layout">
<include file="./Public/public/centerLeft.html" />                      
      
     <div class="right" ms-controller="right" style="min-height: 882px;">
            <h3><a class="button-xs button-blue mr10" href="{:U('DomainAudit/index')}">返回</a>申请域名提交到平台</h3>

            <div class="cnt-tips">
                <p>温馨提示：请将您的域名push到我们对应的注册商账号后，提交申请，不同的注册商请分批提交<br>
                    我们的注册商账号如下：<br>
                </p>
            </div>

            <div>
                <span class="item">
                        易名中国：999518                   </span><span class="item">
                        爱名网：999518                   </span><span class="item">
                        万网：3138212@qq.com                   </span><span class="item">
                        西部数码：duoduoge                   </span><span class="item">
                        190数交所：999518                   </span>            </div>
            <div class="split-dot mt10 mb10"></div>

            <form action="{:U('DomainAudit/insert')}" method="post" id="auditForm">
                <div class="form-inner">
                    <div class="form-row form-row-s">
                        <div class="input-name w30">接受域名品种</div>
                        <div class="input-box w65">
                            <select name="category_id" valid="{required:true}" msg="{required:'请选择品种'}" id="domaintype">
                                <option value="">请选择</option>
                                <volist name="domTypes" id="vo"> 
                                   <option value="{$vo.id}">{$vo.name}</option>
                                </volist>
                            </select>
                        </div>
                        <div class="clr"></div>
                    </div>
                    <div class="form-row form-row-s">
                        <div class="input-name w30">申请提交域名</div>
                        <div class="input-box w65">
                            <textarea class="textarea" name="domains" placeholder="一行一个域名,不要带WWW，一次最多600个"
                             id="inputDomain" valid="{required:true}" msg="{required:'填写已push的域名'}" style="height:300px" 
                             type="true"></textarea>
                            <div class="cnt-tips">
                                <p>续费到期时间一个月以内的域名请勿提交，谢谢！<br>

                                </p>
                            </div>
                        </div>
                        <div class="clr"></div>
                    </div>

                    <div class="form-row form-row-s" style="display: none" id="errorDomain">

                        <div class="input-name w30 red06">以下域名有问题</div>

                        <div class="input-box w70">
                            <div style="width:190%; margin-top:-10px">
                                <div class="cnt-tips">

                                </div>
                            </div>
                        </div>
                        <div class="clr"></div>
                    </div>


                    <div class="form-row form-row-s">
                        <div class="input-name w30">注册商</div>
                        <div class="input-box w40">
                            <select name="domain_registrar" valid="{required:true}" msg="{required:'请选择注册商'}"> 
                            <option value="">选择域名所在的注册商</option>
                             <volist name="list" id="vo"> 
                               <option value="{$vo.busicode}">{$vo.name}</option>
                             </volist>
                            </select> 

                        </div>
                        <div class="clr"></div>
                    </div>


                    <div class="form-row form-row-s">
                        <div class="input-name w30">备注</div>
                        <div class="input-box w65">
                            <textarea class="textarea" name="remark_user"></textarea>
                        </div>
                        <div class="clr"></div>
                    </div>
                    <div class="form-row form-row-s">
                        <div class="input-name w30">图形验证码</div>
                        <div class="input-box w35">
                            <input id="imgcode3290" name="imgcode" type="text" valid="{required:true}"
                             msg="{required:'请填写图形验证码'}" class="input-s ">
                        </div>
                        <div class="input-name-even w35" style="overflow:hidden; height:28px;">
                            		<img id="img4277" prop="verifyImg" name="img" src="{:U('DomainAudit/regverifyCode')}"
                            		 class="code" style="cursor:pointer;margin:-5px 0px -5px 0px">
		<script>
		$(function(){
			var imgcodeid='#img4277';
			$('[prop="verifyImg"]').on('click',function(){
				var src = $(this).attr('src');
				var idx = src.indexOf('?');
				if(idx==-1){
					src += '?'+new Date().getTime()
				} else {
					src = src.substring(0,idx)+'?'+new Date().getTime()
				}
				$('[prop="verifyImg"]').attr('src',src);
			})
		})
		</script>

                        </div>
                        <div class="clr"></div>
                    </div>
                </div>
                <div class="split-dot mt10 mb10 text-center"></div>
                <div class="inner">
                    <div class="form-row form-row-s">
                        <input type="button" action="confirmsubmit" class=" button button-orange fl" 
                        style="width:300px" value="已push并提交申请">
                        <div class="clr"></div>
                    </div>
                </div>

            </form>
        </div>
        
    <div class="clr"></div>
        </div>
        <div class="clr"></div>
    </div>

<div popup="errorSaveDomain" class="reveal-modal medium">
    <a class="close-reveal-modal" action="closeModal">×</a>
    <h3 id="popupTitle">提交失败域名</h3>
    <div><br/>
    <div class="form-row form-row-s" id="errorDomainList">
    </div>
    <div class="split-dot mb20 mt20 text-center">
    </div>
    <div class="form-row form-row-s">
        <a action="cancel" class=" button button-gray w45 fr">取消</a>
        <div class="clr"></div>
    </div>
    </div>
</div>
<include file="./Public/public/footer.html" />
</body></html>